package cn.wolfcode.trip.api.controller;

import cn.wolfcode.trip.base.domain.StrategyComment;
import cn.wolfcode.trip.base.query.CommentQueryObject;
import cn.wolfcode.trip.base.service.ICommentService;
import cn.wolfcode.trip.base.service.IStrategyCommentService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/strategyComments")
public class StrategyCommentController {

    @Autowired
    private IStrategyCommentService strategyCommentService;
    @Autowired
    private ICommentService commentService;


    /**
     * 查询某条攻略评论
     *
     * @param id
     * @return
     */
    @GetMapping("{id}")
    public StrategyComment getById(@PathVariable Long id) {

        return strategyCommentService.get(id);
    }

    /**
     * 查询所有一级点评
     *
     * @return
     */
    @GetMapping("/{strategyCommentId}/comments")
    public PageInfo listComments(CommentQueryObject qo) {
        return commentService.query(qo);
    }


}
